import { defineComponent, onBeforeMount, onMounted, onRenderTracked, onRenderTriggered, ref } from "vue";
import HelloWorld from '../components/HelloWorld.vue'

//  生命周期 & 响应式对象
export default defineComponent({
    setup() {
        let num: any = ref(1);
        onBeforeMount(() => {
            console.log('onBeforeMount');
        })
        onMounted(() => {
            console.log('onMounted');
        })
        onRenderTracked(() => {
            console.log('onRenderTracked');
        })
        onRenderTriggered(() => {
            console.log('onRenderTriggered');
        })
        return {
            num
        }
    },
    methods: {
        doClick() {
            this.num++
        },
    },
    render() {
        return <div class={'test'}>
            <HelloWorld></HelloWorld>
            <p>{this.num}</p>
            <button onClick={() => { this.doClick() }}>加一</button>
        </div>
    },
    components: {
        HelloWorld
    }
})

